export function to<T>(promise: Promise<T>) {
  return promise.then(data => [null, data]).catch(err => [err]);
}